package io.example.common;

import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;

/**
 * Description: HttpUtils.java .<br>
 * <p>Created Time: 2020/10/22 16:06 </p>
 *
 * @author <a href="mail to: mengxiangyuancc@gmail.com" rel="nofollow">孟祥元</a>
 */
public class HttpUtils {

    public static void fireJsonResponse(HttpServerResponse response, int statusCode, String payload) {
        response.putHeader("content-type", "application/json; charset=utf-8").setStatusCode(statusCode).end(payload);
    }

    public static void fireTextResponse(RoutingContext routingContext, String text) {
        routingContext.response().putHeader("content-type", "text/html; charset=utf-8").end(text);
    }
}
